//#include <QObject>
#include <iostream>
#include "signal_man.h"

using namespace std;
//lets try it to see what happens here
//

void Man::setAge(int age_n){

        if (age_n!=this->age){
                    this->age = age_n;
                            emit this->ageChanged(this->age);
        }
}


int main_2(int argc,char *argv[]){

    Man *old = new Man();
    Man *young = new Man();

    //set when we change the old mans age to reflect to the young man 
    QObject::connect(old,SIGNAL(ageChanged(int)),young,SLOT(setAge(int)));

    cout << "Before setting the age of both : old : "<<(old->get_age()) << " and the young man is : " << (young->get_age())<< endl;
    old->setAge(22);

    cout << "After setting the age of the old man his age is : " << (old->get_age()) << endl;
    cout << "After setting the young man is also : "<< (young->get_age()) << endl;


    delete old;
    delete young;

    return 0;

}
